package com.mybatis.test;

import com.mybatis.entity.TUser;
import com.mybatis.mapper.TUserMapper;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 生成的example类的使用
 * Created by 85243 on 2017/5/18.
 */
public class Demo1 {
    private ApplicationContext applicationContext;
    @Before
    public void setUP(){
        applicationContext =new  ClassPathXmlApplicationContext("classpath:applicationContext-dao.xml");
    }

    @Test
    public void test01(){
        TUserMapper userMapper = (TUserMapper) applicationContext.getBean("tuserMapper");
        TUser user = userMapper.selectByPrimaryKey(1);
        System.out.println(user);
    }

}
